package com.ffapp.rainmonitorcustom.bean;


import java.util.ArrayList;

public class AlarmProcessmanListBean extends BaseListBeanYL {

    private ArrayList<AlarmProcessmanListData> list = new ArrayList<AlarmProcessmanListData>();

    public ArrayList<AlarmProcessmanListData> getList() {
        return list;
    }

    public void setList(ArrayList<AlarmProcessmanListData> list) {
        this.list = list;
    }


    public void addListBean(AlarmProcessmanListBean listbean) {
        if (listbean == null)
            return;
        if (this.getCurrentPage() == INIT_PAGE) {
            setList(listbean.getList());
        } else {
            if (list == null)
                list = new ArrayList<>();
            list.addAll(listbean.getList());
        }
        setListBeanData(listbean);
    }

    public void addOrDelete(AlarmProcessmanListData data,ArrayList<AlarmProcessmanListData> listChoose){

        boolean isChecked = false;
        int position = 0;
        AlarmProcessmanListData manData;
        for(int i = 0 ,l = listChoose.size(); i<l ;i ++ ){
            manData = listChoose.get(i);
            if(manData.getCOL_ID().equals(data.getCOL_ID())){
                isChecked = true;
                position = i;
                break;
            }
        }

        if(isChecked){
            listChoose.remove(position);
        }else{
            listChoose.add(data);
        }
    }

    public boolean isCheck(AlarmProcessmanListData data,ArrayList<AlarmProcessmanListData> listChoose){
        for(AlarmProcessmanListData manData:listChoose){
            if(manData.getCOL_ID().equals(data.getCOL_ID())){
                return true;
            }
        }
        return false;
    }

}
